import { g, r } from '@/router/generator'
import Layout from '@/layout'

export default [
  // Content manage
  {
    path: '/content', name: 'ContentManage', component: Layout,
    meta: { title: '资料库', icon: 'el-icon-document', roles: ['ROLE_SUPER_ADMIN'] },
    children: [
      ...r('ContentSecondCategory', '一级分类'),
      ...r('ContentLastCategory', '二级分类'),
      ...r('Content', '资料'),
      ...r('ContentVisit', '阅读记录')
    ]
  },

  // Balance manage
  {
    path: '/balance', name: 'BalanceManage', component: Layout,
    meta: { title: '财务管理', icon: 'el-icon-money', roles: ['ROLE_SUPER_ADMIN'] },
    children: [
      ...g('Balance', '钱包余额'),
      ...r('BalanceLog', '余额变动记录'),
      ...g('SettleItem', '分账记录'),
      ...r('Invoice', '交易凭证'),
      ...r('Transaction', '钱包记录'),
      ...r('Withdraw', '提现记录')
      // ...r('Deposit', '刷卡记录')
    ]
  },

  // Profit manage
  {
    path: '/profit', name: 'ProfitManage', component: Layout,
    meta: { title: '提成管理', icon: 'el-icon-c-scale-to-original', roles: ['ROLE_SUPER_ADMIN'] },
    children: [
      ...r('ProfitType', '分账类型设置'),
      ...r('ProfitRule', '提成规则'),
      {
        path: `/commision/index`,
        name: `CommisionIndex`,
        meta: { title: '提成设置', icon: 'el-icon-caret-right' },
        component: async () => await require('../views/commision/index.vue')
      }
    ]
  },

  // Agentmanage
  // {
  //   path: '/agent', name: 'AgentManage', component: Layout,
  //   meta: { title: '服务商管理', icon: 'el-icon-s-check', roles: ['ROLE_SUPER_ADMIN'] },
  //   children: [
  //     ...r('Agent', '服务商')
  //   ]
  // },

  // Category manage
  {
    path: '/category', name: 'CategoryManage', component: Layout,
    meta: { title: '类型管理', icon: 'el-icon-s-grid', roles: ['ROLE_SUPER_ADMIN'] },
    children: [
      ...r('SalesCategory', '门店类型'),
      ...r('SecondCategory', '产品一级分类'),
      ...r('LastCategory', '产品二级分类')
    ]
  },

  // Store manage
  {
    path: '/store', name: 'StoreManage', component: Layout,
    meta: { title: '门店管理', icon: 'el-icon-s-home', roles: ['ROLE_SUPER_ADMIN'] },
    children: [
      ...r('Region', '区域'),
      ...r('Store', '门店列表'),
      ...r('Team', '团队列表'),
      ...r('Squad', '小队列表'),
      ...r('Staff', '员工列表'),
      ...g('Order', '订单列表'),
      ...r('OrderItem', '订单明细'),
      ...r('OrderShipping', '送货情况'),
      ...r('Fee', '费用'),
      ...g('Investor', '投资人')
    ]
  },

  // Stork manage
  {
    path: '/stock', name: 'StoreManage', component: Layout,
    meta: { title: '库存管理', icon: 'el-icon-files', roles: ['ROLE_SUPER_ADMIN'] },
    children: [
      ...r('Stock', '门店库存'),
      ...r('Inbound', '入库单'),
      ...r('Outbound', '出库单'),
      ...r('Purchase', '采购单')
    ]
  },

  // Product manage
  {
    path: '/product', name: 'ProductManage', component: Layout,
    meta: { title: '产品管理', icon: 'el-icon-goods', roles: ['ROLE_SUPER_ADMIN'] },
    children: [
      ...g('Product', '商品管理'),
      ...r('MaterialCategory', '物料分类'),
      ...r('Material', '产品物料')
      // ...r('SpecificationMaterial', 'boom表')
      // ...g('Specification', '产品规格')
    ]
  },

  // Printer manage
  {
    path: '/printer', name: 'PrinterManage', component: Layout,
    meta: { title: '设备管理', icon: 'el-icon-printer', roles: ['ROLE_SUPER_ADMIN'] },
    children: [
      ...r('Printer', '小票机')
      // ...g('FuiouPosDevice', '富友POS机&台码'),
      // ...g('HuifuPosDevice', '汇付POS机&台码')
    ]
  },

  // User manage
  {
    path: '/user', name: 'UserManage', component: Layout,
    meta: { title: '用户管理', icon: 'el-icon-user', roles: ['ROLE_SUPER_ADMIN'] },
    children: [
      // ...g('Officer', '后台操作账号'),
      ...g('User', '用户'),
      ...r('BankCard', '银行卡')
      // ...g('HuifuAccount', '汇付钱包')
    ]
  },

  // System manage
  {
    path: '/system', name: 'SystemManage', component: Layout,
    meta: { title: '系统选项', icon: 'el-icon-setting', roles: ['ROLE_SUPER_ADMIN'] },
    children: [
      ...r('Type', '词汇表'),
      ...r('Category', '分类'),
      ...r('Album', '相册'),
      ...r('Picture', '图片'),
      ...r('Option', '配置')
    ]
  },

  // ---------------------------------------------------------------------------------
  // Store
  // ---------------------------------------------------------------------------------

  // Company manage
  {
    path: '/company', name: 'CompanyManage', component: Layout,
    meta: { title: '组织管理', icon: 'el-icon-s-custom', roles: ['ROLE_STORE', 'ROLE_AGENT'] },
    children: [
      // ...r('StoreCompany', '资源公司管理'),
      ...r('StoreTeam', '团队管理'),
      ...r('StoreSquad', '小队管理'),
      // ...r('StoreRole', '角色管理'),
      ...g('StoreStaff', '人员管理')
    ]
  },


  // Officer manage
  // {
  //   path: '/officer', name: 'OfficerManage', component: Layout,
  //   meta: { title: '后台账号管理', icon: 'el-icon-user', roles: ['ROLE_STORE'] },
  //   children: [
  //     ...g('StoreOfficer', '后台操作账号')
  //   ]
  // },


  // Order Store
  {
    path: '/order', name: 'orderStore', component: Layout,
    meta: { title: '订单管理', icon: 'el-icon-money', roles: ['ROLE_STORE', 'ROLE_AGENT'] },
    children: [
      // ...r('Invoice', '交易'),
      ...r('StoreOrderItem', '销售订单')
    ]
  },

  // Store Stock
  {
    path: '/stock', name: 'StoreStock', component: Layout,
    meta: { title: '库存管理', icon: 'el-icon-files', roles: ['ROLE_STORE'] },
    children: [
      ...r('StoreStock', '库存列表'),
      ...r('StoreInbound', '入库单'),
      ...r('StoreOutbound', '出库单'),
      ...g('StorePurchase', '采购单')
      // ...r('StoreOtherPurchase', '门店申购单')
      // ...r('StorePurchaseItem', '采购明细')
    ]
  },

  // ---------------------------------------------------------------------------------
  // Officer
  // ---------------------------------------------------------------------------------

  // Company manage
  {
    path: '/officer-company', name: 'OfficerCompanyManage', component: Layout,
    meta: { title: '组织管理', icon: 'el-icon-s-custom', roles: ['ROLE_PERSONNEL'] },
    children: [
      ...r('OfficerCompany', '资源公司管理'),
      ...r('OfficerTeam', '团队管理'),
      ...r('OfficerSquad', '小队管理'),
      ...g('OfficerStaff', '人员管理')
    ]
  },

  // Attendance manage
  {
    path: '/officer-attendance', name: 'OfficerAttendanceManage', component: Layout,
    meta: { title: '考勤管理', icon: 'el-icon-position', roles: ['ROLE_PERSONNEL', 'ROLE_FINANCE'] },
    children: [
      ...r('OfficerStore', '位置设置'),
      ...r('OfficerAttendanceType', '班次设置'),
      ...g('OfficerAttendanceSetting', '迟到设置'),
      // {
      //   path: `/officer-salary/dailyWage`,
      //   name: `OfficerSalaryDailyWage`,
      //   meta: { title: '底薪设置', icon: 'el-icon-caret-right' },
      //   component: async() => await require('../views/officer-salary/dailyWage.vue')
      // },
      ...r('OfficerAttendanceLog', '打卡记录'),
      {
        path: `/officer-attendance-record/index`,
        name: `OfficerAttendanceRecordIndex`,
        meta: { title: '考勤记录', icon: 'el-icon-caret-right' },
        component: async () => await require('../views/officer-attendance-record/index.vue')
      }
    ]
  },

  // Code manage
  {
    path: '/officer-code', name: 'OfficerCodeManage', component: Layout,
    meta: { title: '公示模块', icon: 'el-icon-picture-outline-round', roles: ['ROLE_ATTENDANCE'] },
    children: [
      {
        path: `/officer-code-attendance/index`,
        name: `OfficerCodeAttendanceIndex`,
        meta: { title: '考勤码', icon: 'el-icon-caret-right' },
        component: async () => await require('../views/officer-code-attendance/index.vue')
      }
    ]
  },

  // Invoice manage
  {
    path: '/officer-invoice', name: 'OfficerInvoiceManage', component: Layout,
    meta: { title: '订单管理', icon: 'el-icon-money', roles: ['ROLE_CASHIER', 'ROLE_FINANCE'] },
    children: [
      // ...r('OfficerDeposit', '充值记录'),
      ...r('OfficerOrderItem', '销售订单'),
      {
        path: `/officer-store-statistics/index`,
        name: `OfficerStoreStatisticsIndex`,
        meta: { title: '收银汇总', icon: 'el-icon-caret-right' },
        component: async () => await require('../views/officer-store-statistics/index.vue')
      }
    ]
  },

  // Place manage
  {
    path: '/officer-place', name: 'OfficerPlaceManage', component: Layout,
    meta: { title: '场所管理', icon: 'el-icon-s-home', roles: ['ROLE_FINANCE'] },
    children: [
      {
        path: `/officer-borrow/index`,
        name: `OfficerBorrowIndex`,
        meta: { title: '垫付', icon: 'el-icon-caret-right' },
        component: async () => await require('../views/officer-borrow/index.vue')
      },
      {
        path: `/officer-salary/dailyWage`,
        name: `OfficerSalaryDailyWage`,
        meta: { title: '底薪设置', icon: 'el-icon-caret-right' },
        component: async () => await require('../views/officer-salary/dailyWage.vue')
      },
      ...r('OfficerBond', '保证金'),
      ...r('OfficerFee', '入职费用'),
      ...g('OfficerSalary', '工资发放'),
      {
        path: `/officer-settle-statistics/index`,
        name: `OfficerSettleStatisticsIndex`,
        meta: { title: '分账日结表', icon: 'el-icon-caret-right' },
        component: async () => await require('../views/officer-settle-statistics/index.vue')
      },
      // ...r('OfficerUploadTransaction', '导入发放'),
      {
        path: `/officer-upload-transaction/list`,
        name: `OfficerUploadTransactionIndex`,
        meta: { title: '转账汇款', icon: 'el-icon-caret-right' },
        component: async () => await require('../views/officer-upload-transaction/list.vue')
      },
      {
        path: `/officer-finance-statistics/index`,
        name: `OfficerFinanceStatisticsIndex`,
        meta: { title: '财务汇总', icon: 'el-icon-caret-right' },
        component: async () => await require('../views/officer-finance-statistics/index.vue')
      }
    ]
  },

  // Log manage
  {
    path: '/officer-log', name: 'OfficerLogManage', component: Layout,
    meta: { title: '场所记录', icon: 'el-icon-notebook-1', roles: ['ROLE_FINANCE'] },
    children: [
      ...r('OfficerPenalty', '扣罚记录'),
      ...r('OfficerTransaction', '代收记录'),
      ...g('OfficerSettleItem', '分账记录'),
      // ...g('OfficerBalanceLog', '余额记录'),
      ...r('OfficerWithdraw', '提现记录')
      // ...r('OfficerInvoice', '第三方入金记录')
    ]
  },

  // ---------------------------------------------------------------------------------
  // Finance admin权限下的finance
  // ---------------------------------------------------------------------------------

  // Finance manage
  {
    path: '/finance', name: 'FinanceManage', component: Layout,
    meta: { title: '门店管理', icon: 'el-icon-s-home', roles: ['ROLE_ADMIN'] },
    children: [
      ...r('FinanceStore', '门店列表'),
      ...g('FinanceOrder', '订单列表'),
      ...r('FinanceFee', '报销费用')
    ]
  }
]
